<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <link rel="stylesheet" href="http://cdn.staticfile.org/cesium/1.69.0/Widgets/widgets.css">
    <link rel="stylesheet" href="../css//index.css">
</head>

<body>
    <div class="fun-menu">
        底图切割:
        <button onclick="load()">范围切割</button>
        <button onclick="cancelS()">取消范围切割</button>
    </div>
    <div id=cesiumContainer></div>

    <script src="http://cdn.staticfile.org/cesium/1.69.0/Cesium.js"></script>

    <script src="../libs/cpc/index.js"></script>
    <script>
        const map = new cpc.Map({
            container: "cesiumContainer",
            camera: {
                "position": { "x": 111.64110241866453, "y": 24.136376518752417, "z": 399982.4079558785 }, "angle": { "heading": 12.13, "pitch": -82.06, "roll": 6.281405574342667 },
                duration: 3,
                complete: () => {
                    console.log("飞行结束了");
                }
            },
            baseMaps: [
                {
                    type: "TDTImageryLayer",
                    mold: "image",
                    tk: "7b435c61bff7f77eb49206e10d6397bd",
                },
            ],
        });
        function load() {
            const viewer = map.viewer
            var coffeeBeltRectangle = Cesium.Rectangle.fromDegrees(110.0, 23.43687, 114.0, 25.43687);
            //开启限制
            viewer.scene.globe.cartographicLimitRectangle = coffeeBeltRectangle;
        }
        function cancelS() {
            const viewer = map.viewer
            // //关闭限制
            viewer.scene.globe.cartographicLimitRectangle = undefined;
        }
    </script>
</body>

</html>